#include "Logger.h"

namespace bamboo {
    
void Logger::log(LogEvent::ptr event) {
    if (event->getLevel() >= m_level) {
        for (auto& i : m_appenders) {
            i->log(event);
        }
    }
}

void Logger::addAppender(LogAppender::ptr appender) {
    m_appenders.push_back(appender);
}

void Logger::delAppender(LogAppender::ptr appender) {
    for (auto it = m_appenders.begin();
            it != m_appenders.end(); ++it) {
            if (*it == appender) {
                m_appenders.erase(it);
                break;
            }
        }
}

} // namespace bamboo